******** Datafile: Embargoes, Weapons and Violence: The Conditional Effects of Arms Embargoes on Civilian Targeting - 2024 **********************

******************************** Provide labels ********************************************
//label variable One_sidedviolence "one sided violence osv"
//label variable embargofull_yes_lag "full embargo"
//label variable MCW_import_state_zeros_lag "major conventional weapons imports"
//label variable sa_yes_lag "small arms"
//label variable polity2 "polity 2"
//label variable IntrastateBinary "internal conflict year"
//label variable ethfrac "ethnic fractionalization"
//label variable lrexclpop "ethnic exclusion"
//label variable regchg3 "regime change"
//label variable TradeOpen2 "trade openness"
//label variable poplog_lag "population (log)"
//label variable Non_US_fullembargo_only_lag "NoN-US embargo lag"
//label variable US_fullembargo_only_lag "US full embargo lag"
//label variable L_ciri_PHYSINT "physical integrity rights lag"
//label variable civilwar_yes "atleast one year of conflict 1989-"
     **Main Variables**
	 //One_sidedviolence (Hultman and Eck 2007) 
	//embargofull_yes_lag (Impartial Embargo - Erickson 2013)
	//MCW_import_state_zeros_lag (Total MCW Imports - Sipri 2018)
	//sa_yes_lag  (Small Arms Transfers - Erickson 2013)
	//civilwar_yes ( Equals 1 if Intrastate Binary==1 in any year - UCDP Data)
	//ethfrac (Ethnic Fractionalization - Fearon and Laitin 2003). 
	//lrexclpop  (Ethnic Exclusion - Wimmer, Cederman and Min 2009). 
	//regchg3 (Regime Change - Wimmer, Cederman and Min 2009)
	//TradeOpen2 (World Bank’s Global Development Indicators )
	//poplog_lag (World Bank’s Global Development Indicators )

	
//set more off 	
//xtset group_id Year
	
********Table 1. Analyzing Impartial Arms Embargoes and MCW Flows 
* Model 1
zinb One_sidedviolence embargofull_yes_lag polity2 IntrastateBinary ethfrac lrexclpop regchg3 TradeOpen2 poplog_lag embargofull_seq_sq if civilwar_yes ==1, inflate(polity2 IntrastateBinary ethfrac lrexclpop regchg3 TradeOpen2 poplog_lag) vce(robust)
* Model 2
zinb One_sidedviolence i.embargofull_yes_lag sa_yes_lag MCW_import_state_zeros_lag polity2 IntrastateBinary ethfrac lrexclpop regchg3 TradeOpen2 poplog_lag embargofull_seq_sq if civilwar_yes ==1, inflate( polity2 IntrastateBinary ethfrac lrexclpop regchg3 TradeOpen2 poplog_lag) vce(robust)
* Model 3
zinb One_sidedviolence i.embargofull_yes_lag##c.MCW_import_state_zeros_lag sa_yes_lag polity2 IntrastateBinary ethfrac lrexclpop regchg3 TradeOpen2 poplog_lag embargofull_seq_sq if civilwar_yes ==1, inflate(polity2 IntrastateBinary ethfrac lrexclpop regchg3 TradeOpen2 poplog_lag) vce(robust)
* Model 4
zinb One_sidedviolence i.embargofull_yes_lag sa_yes_lag MCW_import_state_zeros_lag polity2 ethfrac lrexclpop regchg3 TradeOpen2 poplog_lag embargofull_seq_sq if IntrastateBinary ==1, inflate( polity2 ethfrac lrexclpop regchg3 TradeOpen2 poplog_lag) vce(robust)
* Model 5
zinb One_sidedviolence i.embargofull_yes_lag##c.MCW_import_state_zeros_lag sa_yes_lag polity2 ethfrac lrexclpop regchg3 TradeOpen2 poplog_lag embargofull_seq_sq if IntrastateBinary ==1, inflate(polity2  ethfrac lrexclpop regchg3 TradeOpen2 poplog_lag) vce(robust)



********Table 2. Analyzing US versus non-US Impartial Arms Embargoes 
* Model 6
zinb One_sidedviolence i.Non_US_fullembargo_only_lag##c.MCW_import_state_zeros_lag sa_yes_lag polity2 IntrastateBinary ethfrac lrexclpop regchg3 TradeOpen2 poplog_lag embargofull_seq_sq , inflate(polity2 IntrastateBinary ethfrac lrexclpop regchg3 TradeOpen2 poplog_lag) vce(robust)
* Model 7
zinb One_sidedviolence i.Non_US_fullembargo_only_lag##c.MCW_import_state_zeros_lag sa_yes_lag polity2 IntrastateBinary ethfrac lrexclpop regchg TradeOpen2 poplog_lag embargofull_seq_sq if civilwar_yes ==1, inflate(polity2 IntrastateBinary ethfrac lrexclpop regchg3 TradeOpen2 poplog_lag) vce(robust)
* Model 8
zinb One_sidedviolence i.US_fullembargo_only_lag##c.MCW_import_state_zeros_lag sa_yes_lag  polity2 IntrastateBinary ethfrac lrexclpop regchg3 TradeOpen2 poplog_lag embargofull_seq_sq , inflate(polity2 IntrastateBinary ethfrac lrexclpop regchg3 TradeOpen2 poplog_lag) vce(robust)
* Model 9
zinb One_sidedviolence i.US_fullembargo_only_lag##c.MCW_import_state_zeros_lag sa_yes_lag  polity2 IntrastateBinary ethfrac lrexclpop regchg3 TradeOpen2 poplog_lag embargofull_seq_sq if civilwar_yes ==1, inflate(polity2 IntrastateBinary ethfrac lrexclpop regchg3 TradeOpen2 poplog_lag) vce(robust)


***************** FIGURES ( edited in manuscript for style)
* Figure 1
twoway (scatter MCW_import_state_zeros Year), by(embargofull_yes)
* Figure 2
zinb One_sidedviolence i.embargofull_yes_lag##c.MCW_import_state_zeros_lag sa_yes_lag polity2 IntrastateBinary ethfrac lrexclpop regchg3 TradeOpen2 poplog_lag embargofull_seq_sq if civilwar_yes ==1, inflate(polity2 IntrastateBinary ethfrac lrexclpop regchg3 TradeOpen2 poplog_lag) vce(robust)
coefplot, drop(_cons) xline(0)
* Figure 3
zinb One_sidedviolence i.embargofull_yes_lag##c.MCW_import_state_zeros_lag sa_yes_lag polity2 IntrastateBinary ethfrac lrexclpop regchg3 TradeOpen2 poplog_lag embargofull_seq_sq if civilwar_yes ==1, inflate(polity2 IntrastateBinary ethfrac lrexclpop regchg3 TradeOpen2 poplog_lag) vce(robust)
margins, dydx(embargofull_yes_lag) at(MCW_import_state_zeros_lag=(0(500)3000)) atmeans vsquish predict(xb)
marginsplot, legend(position(1) ring(0))
* Figure 4 
zinb One_sidedviolence i.embargofull_yes_lag##c.MCW_import_state_zeros_lag sa_yes_lag polity2 IntrastateBinary ethfrac lrexclpop regchg3 TradeOpen2 poplog_lag embargofull_seq_sq if civilwar_yes ==1, inflate(polity2 IntrastateBinary ethfrac lrexclpop regchg3 TradeOpen2 poplog_lag) vce(robust)
//predict pi_hat, pr
//predict mu_hat
//gen expected_count = (1 - pi_hat) * mu_hat
//egen avg_expected_embargo = mean(expected_count) if embargofull_yes_lag == 1
//egen avg_expected_no_embargo = mean(expected_count) if embargofull_yes_lag == 0
twoway (scatter mu_hat MCW_import_state_zeros_lag) if MCW_import_state_zeros_lag<3000 , by(embargofull_yes)
